package com.zj.weather.utils;

import android.content.Context;

/**
 * Created by ZhaoJie on 2016/9/27.
 */
public class DisplayUtils {

    /**
     * 将dip或dp值转换为px值
     */
    public static float dip2px(Context context, float dipValue) {
        final float scale = context.getResources().getDisplayMetrics().densityDpi;
        return dipValue * (scale / 160);
    }

    /**
     * 获取屏幕宽高
     */
    public static int[] getDefaultDisplayMetrics(Context c) {
        int[] i = new int[2];
        i[0] = c.getResources().getDisplayMetrics().widthPixels;
        i[1] = c.getResources().getDisplayMetrics().heightPixels;
        return i;
    }
}

